﻿using STHPMS1.BLL.B_Core;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace STHPMS1.BLL.B_Bus
{
    public class TestBus : BllBase, ITestBill
    {
        public ITest Get(int id)
        {
            return this.Scene.Dal.Sthpms1.Test.GetById(id);
        }

        public void Save<T>(T entity)
            where T : class ,ITest
        {

            if (entity.Id != null && entity.Id != 0)
                this.Scene.Dal.Sthpms1.Update(entity);
            else
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(ITest entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, ITest
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }
    }
}
